home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / bbs / tdk_v136.zip / TDK_VARS.PAS < prev    next >
Pascal/Delphi Source File  |  1997-08-14  |  13KB  |  286 lines

  1. {
  2.  ▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀    ▀▀   ▀▀
  3.    ▀▀     ▀▀   ▀▀   ▀▀  ▀▀
  4.   ▀▀     ▀▀   ▀▀▀  ▀▀▀▀▀  The DoorKit!
  5.  ▀▀     ▀▀   ▀▀   ▀▀  ▀▀
  6. ▀▀     ▀▀▀▀▀▀    ▀▀    ▀▀
  7. The BBS Door Development Kit By The People - For The People!
  8.  
  9.  
  10.    Feel free to modify or optimize this code at will. All I ask is that if
  11.    find a better way to do things (and you will), please send me a copy of
  12.    your modifications. Thanks in advance!....Larry L. Athey....
  13.  
  14.    This is the variable/constant declaration unit.}
  15.  
  16. {$A+,B-,D+,E+,F+,G+,I-,L+,N-,O-,P-,Q-,R-,S-,T-,V+,X+}
  17. UNIT TDK_VARS;
  18.  
  19. INTERFACE
  20.  
  21. USES DOS;
  22.  
  23. TYPE ControlFile  = RECORD     {Record of settings for each node}
  24.      Month        : WORD;      {The Month, Day, Year variables may be used at}
  25.      Day          : WORD;      {the programmers discretion. I use them in}
  26.      Year         : WORD;      {some doors to keep track of maintenance}
  27.      SFirst       : STRING[20];{Sysop first name}
  28.      SLast        : STRING[20];{Sysop last name}
  29.      SysSec       : WORD;      {Sysop security level on the BBS}
  30.      BBSname      : STRING[40];{The name of the BBS}
  31.      SerialNumber : STRING[10];{Use this if you issue serial numbers}
  32.      HomePath     : STRING[12];{BBS software home path, I use it for Shotgun}
  33.      UseFossil    : BOOLEAN;   {Use FOSSIL comm routines Yes/No}
  34.      PortSpeed    : LONGINT;   {Locked port speed (38000 max for FOSSIL)}
  35.      UseDigi      : BOOLEAN;   {Use DigiBoard comm routines? Yes/No}
  36.      WordSize     : BYTE;      {Data Bits (Normally set to 8)}
  37.      Parity       : CHAR;      {Parity O]dd E]ven N]one (Normally set to N)}
  38.      StopBits     : BYTE;      {Stop Bits (Normally set to 1)}
  39.      InBuffer     : WORD;      {Input buffer size (Default 512)}
  40.      OutBuffer    : WORD;      {Output buffer size (Default 1024)}
  41.      NSP          : BOOLEAN;   {Non-Standard port settings Yes/No}
  42.      Port         : BYTE;      {Comport number}
  43.      IRQ          : BYTE;      {Comport IRQ}
  44.      HexAddr      : STRING[4]; {Comport Hex address}
  45.      END;
  46.  
  47.     {NOTE: Not all settings in the control files are required. They are just
  48.            there in case you find a need for them. Adjust as needed....}
  49.  
  50. TYPE ColorScheme = RECORD    {Record of system colors, expand this at will.}
  51.      Hfg,                    {Window header foreground}
  52.      Hbg,                    {Window header background}
  53.      Wbg,                    {Window background}
  54.      Sfg,                    {Window shadow foreground}
  55.      Sbg,                    {Window shadow background}
  56.      Wh,                     {Window highlight color}
  57.      Wl,                     {Window lowlight color}
  58.      Ffg,                    {Input field text foreground}
  59.      Fbg,                    {Input field text background}
  60.      Bfg,                    {Input field bracket foreground}
  61.      CPBfg,                  {CPrompt bracket foreground}
  62.      CPBbg,                  {CPrompt bracket background}
  63.      CPKfg,                  {CPrompt hotkey foreground}
  64.      CPKbg,                  {CPrompt hotkey background}
  65.      CPTfg,                  {CPrompt text foreground}
  66.      CPTbg,                  {CPrompt text background}
  67.      TxFG,                   {Text reader foreground}
  68.      TxBG : BYTE;            {Text reader background}
  69.      END;
  70.  
  71. TYPE tWhichIO   = (FossilIO,InternalIO,DigiIO);
  72.     {------------------------------------------------------------------------}
  73.     tDoor       = RECORD     {Record for the Door-System variables}
  74.     UserName    : STRING[40];{User's real name}
  75.     Alias       : STRING[40];{User's alias name}
  76.     PassWord    : STRING[40];{User's password}
  77.     UserCity    : STRING[40];{User's location}
  78.     Phone       : STRING[15];{User's home/voice phone number}
  79.     WorkPhone   : STRING[15];{User's work/data phone number}
  80.     BBSname     : STRING[30];{The name of the BBS}
  81.     SysopName   : STRING[30];{The name of this BBS's SysOp}
  82.     Access      : WORD;      {User's security level}
  83.     UserNumber  : WORD;      {User's record number}
  84.     Event       : INTEGER;   {Minutes until next event}
  85.     {------------------------------------------------------------------------}
  86.     Comport     : BYTE;      {Which Comport the program is using; 0=local}
  87.     BaudRate    : LONGINT;   {Actual baud rate for the comport}
  88.     LockBaud    : LONGINT;   {Locked port speed for the comport}
  89.     WhichIO     : tWhichIO;  {Which IO routines to use (fossil or internal)}
  90.     IOinstalled : BOOLEAN;   {Comport IO routines installed?}
  91.     InBufSize   : WORD;      {Input buf size. (only for internal routines)}
  92.     OutBufSize  : WORD;      {Output buf size. (only for internal routines)}
  93.     IRQ         : BYTE;      {Which IRQ is being used}
  94.     WordSize    : BYTE;      {Wordsize (Data Bits) for comport}
  95.     Parity      : CHAR;      {Parity for comport; 'N'=none 'E'=even 'O'=odd}
  96.     StopBits    : BYTE;      {Stop Bits for comport}
  97.     Node        : BYTE;      {Which node the user is on}
  98.     {------------------------------------------------------------------------}
  99.     LocalInputON: BOOLEAN;   {Enable/Disable local keyboard input}
  100. {*} UpdateStatusBar: BOOLEAN;{Update status bar?}
  101. {*} StatusBarY  : BYTE;      {What line the status bar is displayed on}
  102. {*} LocalMaxY   : BYTE;      {# of lines (1-#) to update on local screen (usually 25)}
  103.     {------------------------------------------------------------------------}
  104.     SecondsLeft : LONGINT;   {Seconds Left until user is booted back to BBS}
  105.     MinutesLeft : LONGINT;   {Minutes Left until user is booted back to BBS}
  106. {*} IdleCount   : INTEGER;   {How many seconds the user has been inactive}
  107.     UpdateSecs  : BOOLEAN;   {Update the user's remaining time?}
  108.     UpdateIdle  : BOOLEAN;   {Ckeck for user inactivity?}
  109. {*} LocalKey    : BOOLEAN;   {Was the last key pressed local?}
  110. {*} OnLine      : BOOLEAN;   {Is user online/connected?}
  111.     {------------------------------------------------------------------------}
  112.     END;
  113.  
  114. {*  Variables marked with an asterisk are "Read-Only" and should never be
  115.     modified or altered by your code. AGAIN! - DO NOT TAMPER WITH THESE!}
  116.  
  117. CONST
  118.  _DOS = 0; { DOS      }
  119.   OS2 = 1; { OS/2     }
  120.   WIN = 2; { WinDoze  }
  121.   DV  = 3; { DesqView }
  122.  
  123. CONST
  124.   WrapInput      : BOOLEAN = FALSE;{Word wrap input fields Y/N?}
  125.   Local          : BOOLEAN = TRUE; {Are we running in local mode?}
  126.   Tty            = 0;
  127.   Ansi           = 1;
  128.   Avatar         = 2;
  129.   Rip            = 3;
  130.   Max            = 4;
  131.   Graphics       : BYTE    = Ansi; {Remote caller's graphics protocol}
  132.   ResetRemote    : BOOLEAN = FALSE;{Send a !|1K|*|#|#|# at exit time?}
  133.   InChat         : BOOLEAN = FALSE;{Are we currently in SysOp <> User Chat?}
  134.   UseDoorSys     : BOOLEAN = TRUE; {Allow door to read DOOR.SYS?}
  135.   UseDorInfo     : BOOLEAN = TRUE; {Allow door to read DORINFO#.DEF?}
  136.   UseMxUser      : BOOLEAN = FALSE;{Allow door to read MX_USER.DAT?}
  137.   _HangUp        : BOOLEAN = FALSE;{Lower DTR before terminating?}
  138.   HideParams     : BOOLEAN = FALSE;{Hide information when exiting door?}
  139.   UseTTY         : BOOLEAN = TRUE; {Allow ASCII/TTY callers in the door?}
  140.   KillDrop       : BOOLEAN = FALSE;{Delete drop file before terminating?}
  141.   NoKill         : BOOLEAN = FALSE;{Kill all MAX windows before sending new?}
  142.   IntConfig      : BOOLEAN = FALSE;{Use internal configuration program?}
  143.   UseLocal       : BOOLEAN = TRUE; {Allow local operation of the door?}
  144.   UseLog         : BOOLEAN = FALSE;{Use activity logging?}
  145.   UseAd          : BOOLEAN = TRUE; {Display program ad upon startup?}
  146.   ShowLog        : BOOLEAN = FALSE;{Write activity logging to the screen? [Y/N]}
  147.   Wraplength     : BYTE = 78;      {The maximum word length for input driver.}
  148.   DVseg          : WORD = $B800;   {B800=Color, B000=Mono}
  149.   DVofs          : WORD = $0000;   {The OFS is needed in case I/You create routines
  150.                                     that will write to a virtual page, virtual pages
  151.                                     will not always start at 0000. For more exaples
  152.                                     of writing to virtual pages see ANSIUNIT.PAS}
  153.  
  154. TYPE CursorMoveType = RECORD
  155.      Up             : ARRAY[Tty..Avatar] OF STRING[3];
  156.      Down           : ARRAY[Tty..Avatar] OF STRING[3];
  157.      Right          : ARRAY[Tty..Avatar] OF STRING[3];
  158.      Left           : ARRAY[Tty..Avatar] OF STRING[3];
  159.      Home           : ARRAY[Tty..Avatar] OF STRING[3];
  160.      Endkey         : ARRAY[Tty..Avatar] OF STRING[3];
  161.      Insert         : ARRAY[Tty..Avatar] OF STRING[3];
  162.      Delete         : ARRAY[Tty..Avatar] OF STRING[3];
  163.      END;
  164.  
  165. CONST
  166.   CursorMove : CursorMoveType = (Up     : (#0+#72,#27'[A',#22+#3);
  167.                                  Down   : (#0+#80,#27'[B',#22+#4);
  168.                                  Right  : (#0+#77,#27'[C',#22+#6);
  169.                                  Left   : (#0+#75,#27'[D',#22+#5);
  170.                                  Home   : (#0+#71,#27'[H',#22+#0);
  171.                                  EndKey : (#0+#79,#27'[K',#22+#0);
  172.                                  Insert : (#0+#82,#22,#22);
  173.                                  Delete : (#0+#83,#127,#127));
  174.  
  175. VAR
  176.   OS            : BYTE;       {Operating System: DOS, OS/2, WIN, DV}
  177.   CurTime       : DATETIME;   {The Current Time}
  178.   DropFilePath  : STRING[80]; {Path to drop files}
  179.   Ctl           : ControlFile;{Record for storing door setups per node}
  180.   CS            : ColorScheme;{Record for storing various system colors}
  181.   DoorSys       : tDoor;      {Door-System record}
  182.   StartTime     : DATETIME;   {What time the user entered door}
  183.   BackSpaceChar : CHAR;       {Character to use when the BS key is pressed}
  184.   LengthScr     : BYTE;       {Length of the remote caller's screen}
  185.   CurColor      : BYTE;       {Stores the last text attribute value.}
  186.   MiscFile      : STRING[80]; {Miscellaneous file name passed with /F=}
  187.   MiscDesc      : STRING[60]; {Miscellaneous file name command line desc}
  188.   LogPath       : STRING[80]; {Path to write activity log file}
  189.   LogFile       : STRING[40]; {Activity log file name (Room for variables)}
  190.   UFirst        : STRING[20]; {User's first name}
  191.   ULast         : STRING[20]; {User's last name}
  192.   Insert1       : STRING[79];
  193.   Insert2       : STRING[79];
  194.   Insert3       : STRING[79];
  195.   Insert4       : STRING[79];
  196.   Insert5       : STRING[79]; {Various "Dynamic" global system variables}
  197.   s_ReadKey     : STRING[2];  {Local storage for sReadKey extended keys}
  198.   MaxID         : STRING[4];  {Version of MAX Graphics the caller supports}
  199.   ProgramName   : STRING[80]; {Name and version of the current program}
  200.   ProgramDesc   : STRING[80]; {Description of the current program}
  201.   Copyright     : STRING[80]; {Copyright to display in banner/ad screen}
  202.   ErrLevel      : BYTE;       {Errorlevel to exit the program with}
  203.   {-------------------------------------------------------------------------}
  204.   ClockResult   : LONGINT;    {These are for time keeping purposes only}
  205.   StopClock     : LONGINT;    {Do not mess with these or you could lock}
  206.   StartClock    : LONGINT;    {up your program....}
  207.  
  208. {───────────────────────────────────────────────────────────────────────────}
  209. PROCEDURE DetectOS;
  210. {^ Detects what operating system you are running.}
  211. PROCEDURE TimeSlice;
  212. {^ Gives up remaining CPU time to the rest of the OS. This procedure is set
  213.    up in the sReadkey function already, along with a few other procedures.
  214.    You can use it for your own needs as well.}
  215. {───────────────────────────────────────────────────────────────────────────}
  216.  
  217. IMPLEMENTATION
  218.  
  219. {───────────────────────────────────────────────────────────────────────────}
  220. PROCEDURE DetectOS; Assembler;
  221. Asm
  222.   mov OS, _DOS  { Default DOS }
  223.   mov ah, 30h   { AH = 30h }
  224.   INT 21h       { dos version }
  225.   cmp al, 14h
  226.   jae @IBMOS2   { Jump if >= to 20 }
  227.  
  228.   mov ax,2B01h
  229.   mov cx,4445h
  230.   mov dx,5351h
  231.   INT 21h       { Desqview Installed? }
  232.   cmp al, 255
  233.   jne @DesqView { Jump if AL <> 255 }
  234.  
  235.   mov ax,160Ah
  236.   INT 2Fh       { Windows Installed?}
  237.   cmp ax, 0h
  238.   je @Windows   { If = Jump to Windows }
  239.   jmp @Finish   { Nothing found, go to the end }
  240.  
  241. @IBMOS2 :
  242.   mov OS, Os2   { Set OS Value }
  243.   jmp @Finish
  244.  
  245. @DesqView :
  246.   mov OS, Dv    { Set OS Value }
  247.   jmp @Finish
  248.  
  249. @Windows :
  250.   mov OS, win   { Set OS Value }
  251.   jmp @Finish
  252.  
  253. @FINISH :
  254. END;
  255. {───────────────────────────────────────────────────────────────────────────}
  256. PROCEDURE TimeSlice; Assembler;
  257. Asm
  258.   CMP OS,_DOS   { Compare to DOS }
  259.   JE @__DOS     { Jump if = }
  260.   CMP OS,DV     { Compare to Desqview }
  261.   JE @DESQVIEW  { Jump if = }
  262.   CMP OS, WIN   { Compare to Windows }
  263.   JE @WINOS2    { Jump if = }
  264.   CMP OS, OS2   { Compart OS/2 }
  265.   JE @WINOS2    { Jump if = }
  266.   JMP @NONE     { None found, Jump to End }
  267.  
  268. @__DOS :
  269.   INT 28h       { Interupt 28h }
  270.   JMP @NONE     { Jump to the end }
  271.  
  272. @DESQVIEW :
  273.   MOV ax,1000h  { AX = 1000h }
  274.   INT 15h       { Call Interupt 15h }
  275.   JMP @NONE     { Jump to the end }
  276.  
  277. @WINOS2 :
  278.   MOV AX, 1680h { AX = 1680h }
  279.   INT 2Fh       { Call Interupt 2Fh for WinDoze-OS/2 TimeSlice }
  280.  
  281. @NONE :
  282. END;
  283. {───────────────────────────────────────────────────────────────────────────}
  284.  
  285. END.
  286.